package com.hl.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultEntity implements Serializable {
    private Integer code;
    private String msg;
    private Object data;
    public static ResultEntity ok(){
        return new ResultEntity(200,"操作成功",null);
    }
    public static ResultEntity ok(Object data){
        return new ResultEntity(200,"操作成功",data);
    }
    public static ResultEntity ok(String msg, Object data){
        return new ResultEntity(200,msg,data);
    }
    public static ResultEntity noOk(){
        return new ResultEntity(500,"操作失败",null);
    }
    public static ResultEntity noOk(Integer code){
        return new ResultEntity(code,"操作失败",null);
    }
    public static ResultEntity noOk(Integer code,String msg){
        return new ResultEntity(code,msg,null);
    }
}
